using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for ChevronWebPartZone
/// </summary>
namespace SqlWebAdmin.CSharp.Controls
{
    public class ChevronWebPartChrome : System.Web.UI.WebControls.WebParts.WebPartChrome
    {
        string menuPopupImageUrlAlternate;
        public string MenuPopupImageUrlAlternate
        {
            get { return menuPopupImageUrlAlternate; }
            set { menuPopupImageUrlAlternate = value; }
        }

        public ChevronWebPartChrome(WebPartZoneBase zone, WebPartManager manager)
            : base(zone, manager)
        {
        }

        public override void RenderWebPart(HtmlTextWriter writer, WebPart webPart)
        {
            if (webPart.ChromeState == PartChromeState.Minimized)
                webPart.Zone.MenuPopupImageUrl = this.MenuPopupImageUrlAlternate;

            base.RenderWebPart(writer, webPart);
        }
    }

    public class ChevronWebPartZone : System.Web.UI.WebControls.WebParts.WebPartZone
    {
        public string MenuPopupImageUrlAlternate
        {
            get {
                ChevronWebPartChrome chevron = this.WebPartChrome as ChevronWebPartChrome;
                if (chevron != null)
                    return chevron.MenuPopupImageUrlAlternate;
                else
                    return this.MenuPopupImageUrl;
            }
            set {
                ChevronWebPartChrome chevron = this.WebPartChrome as ChevronWebPartChrome;
                if (chevron != null)
                    chevron.MenuPopupImageUrlAlternate = value; 
            }
        }

        public ChevronWebPartZone()
        {
            base.CloseVerb.Enabled = false;
            base.CloseVerb.Visible = false;
        }

        protected override WebPartChrome CreateWebPartChrome()
        {
            return new WebPartChrome(this, this.WebPartManager);
            //return new ChevronWebPartChrome(this, base.WebPartManager);
        }
    }
}